use strict;
use warnings;

package Lingua::EN::WSD::WebBased::Scenario::WordsInDmozLabels;

use base qw/Lingua::EN::WSD::WebBased::Scenario/;

use Class::AccessorMaker {
    dmoz_structure_db   => undef,
    context_seeder      => undef
}, 'new_init';

use Lingua::EN::WSD::WebBased::Logger;
use Lingua::EN::WSD::WebBased::Utils;
use Lingua::EN::WSD::WebBased::Seeder::DmozLabel;

sub init {

    my $self = shift;

    $self->SUPER::init;

    $self->context_seeder(
        new Lingua::EN::WSD::WebBased::Seeder::DmozLabel(
            wordnet             => $self->wordnet,
            dmoz_structure_db   => $self->dmoz_structure_db
        )
    ) if !defined $self->context_seeder;

}

sub context_to_vector_set {

    my ($self, $context) = @_;

    my $seed_queries = $self->context_seeder->gen_queries($context);
    my $documents = $self->expander->expand($seed_queries);
    
    return [ map { $self->vectorizer->vectorize($_) } @$documents ];

}

sub get_extra_vector_for_context {

    my ($self, $context) = @_;

    return $self->vectorizer->vectorize($self->context_seeder->gen_extra($context));

}

1;

